<?php

namespace App\Http\Controllers;

use App\Jobs\UpdateUserBalance;
use App\Models\User;
use Illuminate\Http\Request;

class UserController extends Controller
{
    //

    public function UpdateUserBalance(Request $request): array
    {
        $param=$request->post();
        $user=new User();
        $amount = 100; // 假设是增加100单位的金额

        // 分发任务
        UpdateUserBalance::dispatch($user, $param['amount'],$param['orderId']);
        return ["code"=>200,"msg"=>"已发送修改余额队列"];
    }
}
